package com.hx.jeeadminbase.utils;

import java.io.*;
import java.sql.Clob;
import java.util.Random;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @Author: xinmiao.xu
 * @Emial: louis_hsu@yeah.net
 * @CreateDate: 2014年8月29日 下午5:39:00
 * @Description:
 */
public class StringUtil extends org.apache.commons.lang3.StringUtils {

	/**
	 * 判断是不是合法的电子邮箱地址
	 * @param str
	 * @return
	 */
	public static boolean isValidEmailAddress(String str) {
		Pattern pattern = Pattern.compile("^([a-zA-Z0-9]+[_|\\_|\\.]?)*[a-zA-Z0-9]+@([0-9a-zA-Z]+.){1,2}(com|net|cn|com.cn)$");
		Matcher mathcer = pattern.matcher(str);
		if (!mathcer.matches()) {
			return false;
		}
		return true;
	}

	/**
	 * 判断字符串是否为null或空串
	 * @param str
	 * @return
	 */
	public static boolean isEmptyStr(String str) {
		if (str != null && !str.isEmpty() && !str.equals("null") && !str.equals("undefined"))
			return false;
		else
			return true;
	}

	/**
	 * 判断一个字符串是否为空白字符串
	 * @param str 要判断的字符串
	 * @return 如果 str 为 null 或空字符串，或者仅包含空白字符([ \t\n\x0B\f\r])，则返回true。
	 */
	public static boolean isEmptyString(String str) {
		return str == null || str.equals("") || str.matches("^\\s+$");
	}

	/**
	 * 将CLOB转成String
	 * @param clob 字段
	 * @return 内容字串，如果出现错误，返回null
	 */
	public String clob2String(Clob clob) {
		if (clob == null) {
			return null;
		}
		StringBuffer sb = new StringBuffer(65535);// 64K
		Reader clobStream = null;// 创建一个输入流对象
		try {
			clobStream = clob.getCharacterStream();
			char[] b = new char[60000];// 每次获取60K
			int i = 0;
			while ((i = clobStream.read(b)) != -1) {
				sb.append(b, 0, i);
			}
		} catch (Exception ex) {
			sb = null;
		} finally {
			try {
				if (clobStream != null) {
					clobStream.close();
				}
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
		return sb.toString();
	}

	/**
	 * 产生一个随机数串
	 * @param size
	 * @return
	 */
	public static String getRandomString(int size) {
		int layer = (int) Math.pow(10, size - 1);
		return String.valueOf(new Random().nextInt(9 * layer) + layer);
	}

	/**
	 * 替换JSON非法字符
	 * @param s
	 * @return
	 */
	public static String filterIllegalJson(String s) {
		if (isEmptyStr(s)) {
			return "";
		}
		if (s.indexOf("\\") != -1) {
			// 将\转义,否则JSON报错
			s = s.replaceAll("\\\\", "\\\\\\\\");
		}
		if (s.indexOf("'") != -1) {
			// 将单引号转义一下，因为JSON串中的字符串类型可以单引号引起来的
			s = s.replaceAll("'", "\\'");
		}
		if (s.indexOf("\"") != -1) {
			// 将双引号转义一下，因为JSON串中的字符串类型可以单引号引起来的
			s = s.replaceAll("\"", "\\\\\"");
		}
		if (s.indexOf("\r\n") != -1) {
			// 将回车换行转换一下，因为JSON串中字符串不能出现显式的回车换行
			s = s.replaceAll("\r\n", "\\\\u000d\\\\u000a");
		}
		if (s.indexOf("\r") != -1) {
			s = s.replaceAll("\r", "\\\\u000d");
		}
		if (s.indexOf("\n") != -1) {
			// 将换行转换一下，因为JSON串中字符串不能出现显式的换行
			s = s.replaceAll("\n", "\\\\u000a");
		}
		return s;
	}

	/**
	 * 字符串替换
	 * @param sourceStr
	 * @param oldStr
	 * @param newStr
	 * @return
	 */
	public static final String replace(String sourceStr, String oldStr, String newStr) {
		if (sourceStr == null) {
			return null;
		}
		int i = 0;
		if ((i = sourceStr.indexOf(oldStr, i)) >= 0) {
			char[] line2 = sourceStr.toCharArray();
			char[] newString2 = newStr.toCharArray();
			int oLength = oldStr.length();
			StringBuffer buf = new StringBuffer(line2.length);
			buf.append(line2, 0, i).append(newString2);
			i += oLength;
			int j = i;
			while ((i = sourceStr.indexOf(oldStr, i)) > 0) {
				buf.append(line2, j, i - j).append(newString2);
				i += oLength;
				j = i;
			}
			buf.append(line2, j, line2.length - j);
			return buf.toString();
		}
		return sourceStr;
	}

	/**
	 * 获取带中文的字符串长度(中文占2个长度)
	 * @param value
	 * @return
	 */
	public static int chineseStrLength(String value) {
		int valueLength = 0;
		String chinese = "[\u0391-\uFFE5]";
		/* 获取字段值的长度，如果含中文字符，则每个中文字符长度为2，否则为1 */
		for (int i = 0; i < value.length(); i++) {
			/* 获取一个字符 */
			String temp = value.substring(i, i + 1);
			/* 判断是否为中文字符 */
			if (temp.matches(chinese)) {
				/* 中文字符长度为2 */
				valueLength += 2;
			} else {
				/* 其他字符长度为1 */
				valueLength += 1;
			}
		}
		return valueLength;
	}

	/**
	 * 输入流转字符串
	 * @param is
	 * @param charset
	 * @return
	 */
	public static String inputStream2String(InputStream is, String charset) {
		if (isEmptyStr(charset)) {
			charset = "UTF-8";
		}
		final int BUFFER_SIZE = 4096;
		ByteArrayOutputStream outStream = new ByteArrayOutputStream();
		byte[] data = new byte[BUFFER_SIZE];
		int count = -1;
		try {
			while ((count = is.read(data, 0, BUFFER_SIZE)) != -1) {
				outStream.write(data, 0, count);
			}
			data = null;
			return new String(outStream.toByteArray(), charset);
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			if (is != null) {
				try {
					is.close();
				} catch (Exception e2) {
				}
			}
		}
		return null;
	}

	/**
	 * InputStream --> String(无字符集编码)
	 * @param is
	 * @return
	 */
	public static String inputStream2StringNoCharset(InputStream is) {
		BufferedReader in = new BufferedReader(new InputStreamReader(is));
		StringBuffer buffer = new StringBuffer();
		String line = "";
		try {
			while ((line = in.readLine()) != null) {
				buffer.append(line);
			}
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			if (is != null) {
				try {
					is.close();
				} catch (Exception e2) {
				}
			}
			if (in != null) {
				try {
					in.close();
				} catch (Exception e2) {
				}
			}
		}
		return buffer.toString();
	}

	/**
	 * 统计某个子串在母串 中出现的次数
	 * @param s
	 * @param o
	 * @return
	 */
	public static int countStrInTargetStr(String s, String o) {
		int i = 0;
		for (int index = s.indexOf(o); index >= 0; index = s.indexOf(o, index + 1)) {
			i++;
		}
		return i;
	}

	/**
	 * 判断字符是否为中文字符
	 * @param paramChar
	 * @return
	 */
	public static boolean isChinese(char paramChar) {
		Character.UnicodeBlock ub = Character.UnicodeBlock.of(paramChar);
		if (ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS || ub == Character.UnicodeBlock.CJK_COMPATIBILITY_IDEOGRAPHS || ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A
				|| ub == Character.UnicodeBlock.GENERAL_PUNCTUATION || ub == Character.UnicodeBlock.CJK_SYMBOLS_AND_PUNCTUATION || ub == Character.UnicodeBlock.HALFWIDTH_AND_FULLWIDTH_FORMS) {
			return true;
		}
		return false;
	}

	/**
	 * 判断字符是否为字母
	 * @param paramChar
	 * @return
	 */
	public static boolean isAlpha(char paramChar) {
		return ((paramChar >= 'a') && (paramChar <= 'z')) || ((paramChar >= 'A') && (paramChar <= 'Z'));
	}

	/**
	 * 判断字符是否为数字
	 * @param paramChar
	 * @return
	 */
	public static boolean isNum(char paramChar) {
		return (paramChar >= '0') && (paramChar <= '9');
	}

	/**
	 * 是否为数字
	 * @param str
	 * @return
	 */
	public static boolean isNumber(String str) {
		java.util.regex.Pattern pattern = java.util.regex.Pattern.compile("^[-\\+]?[0-9]*");
		java.util.regex.Matcher match = pattern.matcher(str.trim());
		if (match.matches() == false) {
			return false;
		} else {
			return true;
		}
	}

	/**
	 * 是否是数字字符串(包含负数与浮点数)
	 * @param str
	 * @return
	 */
	public static boolean isDigital(String str) {
		Pattern pattern = Pattern.compile("^[-\\+]?[.\\d]*$");
		return pattern.matcher(str).matches();
	}

	/**
	 * 判断号码是否为QQ号码
	 * @param paramString
	 * @return
	 */
	public static boolean isValidQQNum(String paramString) {
		if ((paramString == null) || (paramString.length() <= 0))
			return false;
		paramString = paramString.trim();
		try {
			long l;
			return ((l = Long.valueOf(paramString).longValue()) > 0L) && (l <= 4294967295L);
		} catch (NumberFormatException localNumberFormatException) {
			localNumberFormatException.printStackTrace();
		}
		return false;
	}

	/**
	 * 判断是否为有效的Email地址
	 * @param paramString
	 * @return
	 */
	public static boolean isValidEmail(String paramString) {
		if ((paramString == null) || (paramString.length() <= 0))
			return false;
		return paramString.trim().matches("^[a-zA-Z0-9][\\w\\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\\w\\.-]*[a-zA-Z0-9]\\.[a-zA-Z][a-zA-Z\\.]*[a-zA-Z]$");
	}

	/**
	 * 将字符串转成utf8编码
	 * @param str
	 * @return
	 */
	public static String str2utf8(String str) {
		try {
			if (str != null) {
				return new String(str.getBytes("UTF-8"));
			}
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		}
		return str;
	}

	/**
	 * 去除回车、换行符、制表符
	 * @param str
	 * @return
	 */
	public static String replaceBlank(String str) {
		String dest = "";
		if (str != null) {
			Pattern p = Pattern.compile("\\t|\r|\n");
			Matcher m = p.matcher(str);
			dest = m.replaceAll("");
		}
		return dest;
	}

	/**
	 * 带中文字符截取
	 * @param str
	 * @param len
	 * @return
	 * @throws Exception
	 */
	public static String subChineseStr(String str, int len) {
		try {
			int changdu = str.getBytes("GBK").length;
			if (changdu > len) {
				str = str.substring(0, str.length() - 1);
				str = subChineseStr(str, len);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return str;
	}

	public static String subChineseStrBuffer(String str, int num) {
		StringBuffer sb = new StringBuffer();
		int charlen = 0;
		int strlength = str.length();
		try {
			for (int i = 0; i < strlength; i++) {
				String temp = str.substring(i, i + 1);
				charlen += temp.getBytes("GBK").length;
				if (charlen <= num) {
					sb.append(temp);
				} else {
					break;
				}
			}
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		}

		return sb.toString().length() < strlength ? sb.toString() + "..." : sb.toString();
	}


	public static void main(String[] args) throws Exception {
		String x = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><R><H><F n=\"RESULT_CODE\">1</F><F n=\"RESULT_INFO\">接口调用成功</F><F n=\"BUSI_RETURN_CODE\">1</F><F n=\"BUSI_RETURN_INFO\">客户个人资料查询成功</F></H><B><S><F n=\"CHARGECOUNT\">9</F><F n=\"MEMBER\">cherish1224</F><F n=\"SCORE\">7600</F><F n=\"CARDSTATUS\">正常</F><F n=\"CIDTYPE\">身份证</F><F n=\"CIDNUMBER\">123123</F><F n=\"RECHARGECOUNT\">10</F><F n=\"DATESTART\">2015-07-13 15:14:19.0</F><F n=\"CARDNO\">60000006</F><F n=\"PAYTEL\">18670398280</F><F n=\"PAYCOUNT\">1</F><F n=\"CARDTYPENAME\">电子会员卡</F><F n=\"TOTALAMOUNT\">3878.00</F><F n=\"NOTES\">231</F></S><M><L><F n=\"BALANCE\">3878</F><F n=\"ONEAMOUNT\">-122</F><F n=\"PERSONNAME\">cherish1224</F><F n=\"OPUSERNAME\">aa</F><F n=\"PAYMETHOD\">现金</F><F n=\"PAYTYPEID\">4</F><F n=\"AMOUNT\">-122</F><F n=\"OPUSERID\">225</F><F n=\"PURPOSE\">修正</F><F n=\"CARDTYPEID\">1</F><F n=\"TIMEMAKE\">2015-07-24 18:34:08.0</F><F n=\"SHOPBSEQID\">1</F><F n=\"PAYTYPENAME\">调整</F><F n=\"CARDNO\">60000006</F><F n=\"PAYTEL\">18670398280</F><F n=\"PAYID\">2030</F><F n=\"CARDTYPENAME\">电子会员卡</F><F n=\"FIRMNAME\">商学院店</F><F n=\"BSEQID\"></F><F n=\"TOTALAMOUNTREMAIN\">3878</F><F n=\"FIRMID\">96</F><F n=\"ACTIMES\">21</F></L><L><F n=\"BALANCE\">4000</F><F n=\"ONEAMOUNT\">-1000</F><F n=\"PERSONNAME\">cherish1224</F><F n=\"OPUSERNAME\">aa</F><F n=\"PAYMETHOD\">现金</F><F n=\"PAYTYPEID\">4</F><F n=\"AMOUNT\">-1000</F><F n=\"OPUSERID\">225</F><F n=\"PURPOSE\">修正</F><F n=\"CARDTYPEID\">1</F><F n=\"TIMEMAKE\">2015-07-24 18:33:36.0</F><F n=\"SHOPBSEQID\">1</F><F n=\"PAYTYPENAME\">调整</F><F n=\"CARDNO\">60000006</F><F n=\"PAYTEL\">18670398280</F><F n=\"PAYID\">2024</F><F n=\"CARDTYPENAME\">电子会员卡</F><F n=\"FIRMNAME\">商学院店</F><F n=\"BSEQID\"></F><F n=\"TOTALAMOUNTREMAIN\">4000</F><F n=\"FIRMID\">96</F><F n=\"ACTIMES\">20</F></L><L><F n=\"BALANCE\">5000</F><F n=\"ONEAMOUNT\">-175</F><F n=\"PERSONNAME\">cherish1224</F><F n=\"OPUSERNAME\">aa</F><F n=\"PAYMETHOD\">现金</F><F n=\"PAYTYPEID\">4</F><F n=\"AMOUNT\">-175</F><F n=\"OPUSERID\">225</F><F n=\"PURPOSE\">修正</F><F n=\"CARDTYPEID\">1</F><F n=\"TIMEMAKE\">2015-07-24 18:33:05.0</F><F n=\"SHOPBSEQID\">1</F><F n=\"PAYTYPENAME\">调整</F><F n=\"CARDNO\">60000006</F><F n=\"PAYTEL\">18670398280</F><F n=\"PAYID\">2013</F><F n=\"CARDTYPENAME\">电子会员卡</F><F n=\"FIRMNAME\">商学院店</F><F n=\"BSEQID\"></F><F n=\"TOTALAMOUNTREMAIN\">5000</F><F n=\"FIRMID\">96</F><F n=\"ACTIMES\">19</F></L><L><F n=\"BALANCE\">5000</F><F n=\"ONEAMOUNT\">800</F><F n=\"PERSONNAME\">cherish1224</F><F n=\"OPUSERNAME\">aa</F><F n=\"PAYMETHOD\">现金</F><F n=\"PAYTYPEID\">2</F><F n=\"AMOUNT\">800</F><F n=\"OPUSERID\">225</F><F n=\"PURPOSE\">正常</F><F n=\"CARDTYPEID\">1</F><F n=\"TIMEMAKE\">2015-07-24 18:28:13.0</F><F n=\"SHOPBSEQID\">60000006</F><F n=\"PAYTYPENAME\">充值</F><F n=\"CARDNO\">60000006</F><F n=\"PAYTEL\">18670398280</F><F n=\"PAYID\">1992</F><F n=\"CARDTYPENAME\">电子会员卡</F><F n=\"FIRMNAME\">商学院店</F><F n=\"BSEQID\"></F><F n=\"TOTALAMOUNTREMAIN\">5175</F><F n=\"FIRMID\">96</F><F n=\"ACTIMES\">18</F></L><L><F n=\"BALANCE\">4375</F><F n=\"ONEAMOUNT\">800</F><F n=\"PERSONNAME\">cherish1224</F><F n=\"OPUSERNAME\">aa</F><F n=\"PAYMETHOD\">现金</F><F n=\"PAYTYPEID\">2</F><F n=\"AMOUNT\">800</F><F n=\"OPUSERID\">225</F><F n=\"PURPOSE\">正常</F><F n=\"CARDTYPEID\">1</F><F n=\"TIMEMAKE\">2015-07-24 18:26:13.0</F><F n=\"SHOPBSEQID\">60000006</F><F n=\"PAYTYPENAME\">充值</F><F n=\"CARDNO\">60000006</F><F n=\"PAYTEL\">18670398280</F><F n=\"PAYID\">1988</F><F n=\"CARDTYPENAME\">电子会员卡</F><F n=\"FIRMNAME\">商学院店</F><F n=\"BSEQID\"></F><F n=\"TOTALAMOUNTREMAIN\">4375</F><F n=\"FIRMID\">96</F><F n=\"ACTIMES\">17</F></L><L><F n=\"BALANCE\">3575</F><F n=\"ONEAMOUNT\">800</F><F n=\"PERSONNAME\">cherish1224</F><F n=\"OPUSERNAME\">aa</F><F n=\"PAYMETHOD\">现金</F><F n=\"PAYTYPEID\">2</F><F n=\"AMOUNT\">800</F><F n=\"OPUSERID\">223</F><F n=\"PURPOSE\">正常</F><F n=\"CARDTYPEID\">1</F><F n=\"TIMEMAKE\">2015-07-23 15:26:41.0</F><F n=\"SHOPBSEQID\">60000006</F><F n=\"PAYTYPENAME\">充值</F><F n=\"CARDNO\">60000006</F><F n=\"PAYTEL\">18670398280</F><F n=\"PAYID\">1770</F><F n=\"CARDTYPENAME\">电子会员卡</F><F n=\"FIRMNAME\">商学院店</F><F n=\"BSEQID\"></F><F n=\"TOTALAMOUNTREMAIN\">3575</F><F n=\"FIRMID\">96</F><F n=\"ACTIMES\">16</F></L><L><F n=\"BALANCE\">2775</F><F n=\"ONEAMOUNT\">-1000</F><F n=\"PERSONNAME\">cherish1224</F><F n=\"OPUSERNAME\">aa</F><F n=\"PAYMETHOD\">现金</F><F n=\"PAYTYPEID\">4</F><F n=\"AMOUNT\">-1000</F><F n=\"OPUSERID\">223</F><F n=\"PURPOSE\">修正</F><F n=\"CARDTYPEID\">1</F><F n=\"TIMEMAKE\">2015-07-23 10:44:55.0</F><F n=\"SHOPBSEQID\">1</F><F n=\"PAYTYPENAME\">调整</F><F n=\"CARDNO\">60000006</F><F n=\"PAYTEL\">18670398280</F><F n=\"PAYID\">1741</F><F n=\"CARDTYPENAME\">电子会员卡</F><F n=\"FIRMNAME\">商学院店</F><F n=\"BSEQID\"></F><F n=\"TOTALAMOUNTREMAIN\">2775</F><F n=\"FIRMID\">96</F><F n=\"ACTIMES\">15</F></L><L><F n=\"BALANCE\">3775</F><F n=\"ONEAMOUNT\">25</F><F n=\"PERSONNAME\">cherish1224</F><F n=\"OPUSERNAME\">aa</F><F n=\"PAYMETHOD\"></F><F n=\"PAYTYPEID\">3</F><F n=\"AMOUNT\">-25</F><F n=\"OPUSERID\">223</F><F n=\"PURPOSE\"></F><F n=\"CARDTYPEID\">1</F><F n=\"TIMEMAKE\">2015-07-23 10:02:25.0</F><F n=\"SHOPBSEQID\">698</F><F n=\"PAYTYPENAME\">消费</F><F n=\"CARDNO\">60000006</F><F n=\"PAYTEL\">18670398280</F><F n=\"PAYID\">1718</F><F n=\"CARDTYPENAME\">电子会员卡</F><F n=\"FIRMNAME\">商学院店</F><F n=\"BSEQID\"></F><F n=\"TOTALAMOUNTREMAIN\">3775</F><F n=\"FIRMID\">96</F><F n=\"ACTIMES\">14</F></L><L><F n=\"BALANCE\">3800</F><F n=\"ONEAMOUNT\">800</F><F n=\"PERSONNAME\">cherish1224</F><F n=\"OPUSERNAME\">aa</F><F n=\"PAYMETHOD\">现金</F><F n=\"PAYTYPEID\">2</F><F n=\"AMOUNT\">800</F><F n=\"OPUSERID\">223</F><F n=\"PURPOSE\">正常</F><F n=\"CARDTYPEID\">1</F><F n=\"TIMEMAKE\">2015-07-23 09:52:56.0</F><F n=\"SHOPBSEQID\">60000006</F><F n=\"PAYTYPENAME\">充值</F><F n=\"CARDNO\">60000006</F><F n=\"PAYTEL\">18670398280</F><F n=\"PAYID\">1711</F><F n=\"CARDTYPENAME\">电子会员卡</F><F n=\"FIRMNAME\">商学院店</F><F n=\"BSEQID\"></F><F n=\"TOTALAMOUNTREMAIN\">3800</F><F n=\"FIRMID\">96</F><F n=\"ACTIMES\">13</F></L><L><F n=\"BALANCE\">3000</F><F n=\"ONEAMOUNT\">800</F><F n=\"PERSONNAME\">cherish1224</F><F n=\"OPUSERNAME\">aa</F><F n=\"PAYMETHOD\">现金</F><F n=\"PAYTYPEID\">2</F><F n=\"AMOUNT\">800</F><F n=\"OPUSERID\">223</F><F n=\"PURPOSE\">正常</F><F n=\"CARDTYPEID\">1</F><F n=\"TIMEMAKE\">2015-07-22 09:39:57.0</F><F n=\"SHOPBSEQID\">60000006</F><F n=\"PAYTYPENAME\">充值</F><F n=\"CARDNO\">60000006</F><F n=\"PAYTEL\">18670398280</F><F n=\"PAYID\">1612</F><F n=\"CARDTYPENAME\">电子会员卡</F><F n=\"FIRMNAME\">商学院店</F><F n=\"BSEQID\"></F><F n=\"TOTALAMOUNTREMAIN\">3000</F><F n=\"FIRMID\">96</F><F n=\"ACTIMES\">12</F></L><L><F n=\"BALANCE\">2200</F><F n=\"ONEAMOUNT\">-500</F><F n=\"PERSONNAME\">cherish1224</F><F n=\"OPUSERNAME\">aa</F><F n=\"PAYMETHOD\">现金</F><F n=\"PAYTYPEID\">4</F><F n=\"AMOUNT\">-500</F><F n=\"OPUSERID\">223</F><F n=\"PURPOSE\">修正</F><F n=\"CARDTYPEID\">1</F><F n=\"TIMEMAKE\">2015-07-22 08:41:49.0</F><F n=\"SHOPBSEQID\">1</F><F n=\"PAYTYPENAME\">调整</F><F n=\"CARDNO\">60000006</F><F n=\"PAYTEL\">18670398280</F><F n=\"PAYID\">1597</F><F n=\"CARDTYPENAME\">电子会员卡</F><F n=\"FIRMNAME\">商学院店</F><F n=\"BSEQID\"></F><F n=\"TOTALAMOUNTREMAIN\">2200</F><F n=\"FIRMID\">96</F><F n=\"ACTIMES\">11</F></L><L><F n=\"BALANCE\">2700</F><F n=\"ONEAMOUNT\">800</F><F n=\"PERSONNAME\">cherish1224</F><F n=\"OPUSERNAME\">zyh</F><F n=\"PAYMETHOD\">现金</F><F n=\"PAYTYPEID\">2</F><F n=\"AMOUNT\">800</F><F n=\"OPUSERID\">213</F><F n=\"PURPOSE\">正常</F><F n=\"CARDTYPEID\">1</F><F n=\"TIMEMAKE\">2015-07-21 11:18:06.0</F><F n=\"SHOPBSEQID\">60000006</F><F n=\"PAYTYPENAME\">充值</F><F n=\"CARDNO\">60000006</F><F n=\"PAYTEL\">18670398280</F><F n=\"PAYID\">1537</F><F n=\"CARDTYPENAME\">电子会员卡</F><F n=\"FIRMNAME\">商学院店</F><F n=\"BSEQID\"></F><F n=\"TOTALAMOUNTREMAIN\">2700</F><F n=\"FIRMID\">96</F><F n=\"ACTIMES\">10</F></L><L><F n=\"BALANCE\">1900</F><F n=\"ONEAMOUNT\">800</F><F n=\"PERSONNAME\">cherish1224</F><F n=\"OPUSERNAME\">zyh</F><F n=\"PAYMETHOD\">现金</F><F n=\"PAYTYPEID\">2</F><F n=\"AMOUNT\">800</F><F n=\"OPUSERID\">213</F><F n=\"PURPOSE\">正常</F><F n=\"CARDTYPEID\">1</F><F n=\"TIMEMAKE\">2015-07-21 11:16:16.0</F><F n=\"SHOPBSEQID\">60000006</F><F n=\"PAYTYPENAME\">充值</F><F n=\"CARDNO\">60000006</F><F n=\"PAYTEL\">18670398280</F><F n=\"PAYID\">1534</F><F n=\"CARDTYPENAME\">电子会员卡</F><F n=\"FIRMNAME\">商学院店</F><F n=\"BSEQID\"></F><F n=\"TOTALAMOUNTREMAIN\">1900</F><F n=\"FIRMID\">96</F><F n=\"ACTIMES\">9</F></L></M></B></R>";
		//System.out.println(formatXML(x));
		/*try {
			int changdu = x.getBytes("GBK").length;
			System.out.println(changdu);
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		}*/
		//System.out.println(x.substring(0,3998));
		//x = subChineseStrBuffer(x,3998);
		//System.out.println(x);
		/*String s = getRandomString(8);
		System.out.println(s);
		
		boolean f = StringUtil.isBlank("");
		System.out.println(f);*/
	}
}
